package mvc.model

import java.text.SimpleDateFormat
import java.util.*

open class MediaData(startTime: String, endTime: String) {
    private val startCount: Int
    private val endCount: Int

    var isError = false

    fun isExist(): Boolean {
        val current = Calendar.getInstance()
        val cc = current.get(Calendar.HOUR_OF_DAY) * 60 + current.get(Calendar.MINUTE)
        return (cc >= startCount) && (cc <= endCount)
    }

    init {
        val format = SimpleDateFormat("HH:mm")
        val start = format.parse(startTime)
        val end = format.parse(endTime)
        startCount = start.hours * 60 + start.minutes
        endCount = end.hours * 60 + end.minutes
    }
}